import request from '@/utils/request';

// 获取用户
export const getUserList = data => request({
  url: '/api/user/get',
  method: 'post',
  data: data
});

// 添加用户
export const userAdd = data => request({
  url: '/api/user/add',
  method: 'post',
  data: data
});

// 修改用户
export const userUpdate = data => request({
  url: '/api/user/update',
  method: 'put',
  data: data
});

// 校验用户
export const userCheck = data => request({
  url: `/api/user/check/${data}`,
  method: 'post'
});

// 从iam获取用户
export const getByIamUser = data => request({
  url: `/api/user/getByIam/${data}`,
  method: 'post'
});

// 删除用户
export const userDelete = data => request({
  url: `/api/user/delete/${data}`,
  method: 'delete'
});

// 角色下拉筛选
export const selectRoleList = data => request({
  url: '/api/permission/selectRoleList',
  method: 'get',
  params: data
});

// 小组下拉筛选
export const selectGroupList = data => request({
  url: '/api/permission/selectGroupList',
  method: 'get',
  params: data
});

// 下载员工信息导入模板
export const downloadUserTemplate = data => request({
  url: '/api/user/download',
  responseType: 'blob',
  method: 'get',
  params: data
});

// 员工信息预导入
export const preImportUser = (data, fun) => request({
  url: '/api/user/preImportUser',
  method: 'post',
  data: data,
  onUploadProgress: fun
});

// 员工信息导入
export const importUser = (data, fun) => request({
  url: '/api/user/importUser',
  method: 'post',
  data: data,
  onUploadProgress: fun
});
